import Vue from 'vue'
import Vuex from 'vuex'

import gameInfo from "../data/gameInfo.json";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
	  avator:"", //记录用户上传头像
	  gender:"", //用户性别
	  type:1 ,//默认游戏类型 1：择偶 2：脱单日 3：桃花运
	  htitleUrl:"", //设置头部标题图片
  },
  mutations: {
	  set_avator(state,avator){
		  state.avator = avator;
	  },
	  set_gender(state,gender){
		  state.gender = gender;
	  },
	  set_type(state,type){
		  state.type = type;
		  // 更新htitleUrl的值
		  state.htitleUrl = gameInfo['type'+type].scene_title.home_title_url;
		  // 更新页面title
		  document.title = gameInfo['type'+type].title;
	  }
  },
  actions: {
  },
  modules: {
  }
})
